package com.gxnzd.communityelderly.config;
import com.gxnzd.communityelderly.filter.UserInterceptor;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * ClassName: InterceptorConfig
 * Package: com.gxnzd.communityelderly.config
 * Description:
 *
 * @Author 胡海峰
 * @Create 2024/10/14 22:19
 * @Version 1.0
 */
@Configuration  // 配置类
public class InterceptorConfig implements WebMvcConfigurer {
    @Resource
    private  UserInterceptor userInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(userInterceptor)
                .excludePathPatterns("/employee/login","/employee/logout","/common/*","/employee/changePassword","/employee/loginPhone")
                .addPathPatterns("/**") ;  // 放行登录 退出
    }


}
